package com.vonchange.utils.jsp.res;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.vonchange.utils.res.min.CssMinUtils;

public class CssMinTag extends TagSupport {
	private static final long serialVersionUID = 7993561430778220336L;
	private String src;

	public String getSrc() {
		return src;
	}

	public void setSrc(String src) {
		this.src = src;
	}
	@Override
    public int doStartTag() throws JspException {
        try {
            JspWriter out = this.pageContext.getOut();
            if(src == null) {
                out.println("");
                return SKIP_BODY;
            }
            String result=CssMinUtils.genSrc(src);
            out.println(result);
        } catch(Exception e) {
        	e.printStackTrace();
            throw new JspException(e.getMessage());

        }
        return SKIP_BODY;
    }

    @Override
    public int doEndTag() throws JspException {
        return EVAL_PAGE;
    }

    @Override
    public void release() {
        super.release();
        this.src = null;
    }

}
